package com.kevis.zhunblog.admin.security.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 继承 security的 User，因为我这里只有一个角色，所以为了后续方便，就不存系统的 GrantedAuthority
 */
public class SecurityUser extends User {
    public SecurityUser(String username, String password,int roleId, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.roleId = roleId;
    }

    public SecurityUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
    }

    public SecurityUser(){
        super("","",null);

    }

    /**
     * 角色id
     */
    private int roleId;

    public int getRoleId() {
        return roleId;
    }

    public void setRoleId(int roleId) {
        this.roleId = roleId;
    }

    private Integer userId;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }


}
